<?php

/**
 * Created by PhpStorm.
 * User: luanpeng
 * Date: 2017/2/7
 * Time: 18:25
 */
namespace app\index\validate;

class Pub extends Base
{
    protected $rule =   [
        '__token__' => 'token',
        'phone'  => 'require|phone', //phone 自定义
        'password' => 'require|min:6',
        'code'=>'require|length:6',
        'uidMd5'  => 'require|length:32',
    ];

    protected $message  =   [
        '__token__.token' => '表单令牌不正确,请保存表单相关数据并手动刷新页面!',
        'phone.require' => '手机号码必须填写',
        'phone.phone'     => '手机号码格式必须正确',
        'password.require'  => '密码必须填写',
        'password.min'        => '密码长度必须大于等于6位',
        'code.require'  => '验证码必须填写',
        'code.length'        => '验证码的长度必须是6位',
        'c_fax.require'        => 'fax必须填写',
        'uidMd5.length'  => '用户秘钥长度必须是32位',
    ];

    protected $scene = [
        'tk' => ['__token__'],
        'login'  =>  ['phone','password'],
        'reUser'  =>  ['phone','password','code'],
        'codePhone' => ['phone','code']
    ];

    /* 验证规则
    http://www.kancloud.cn/manual/thinkphp5/129356
'smsType' => 'require|in:1,2,3,4,5',
'smsType.require' => '邮箱地址必须填写',

'cardId'  => 'require|idCard',
'cardId.idCard'  => '身份证号码格式必须填写正确',

'cardPos' => 'require|url',
'cardPos.url'    => '身份证正面必须为有效地址',

'tagList'  =>'require|noOrJsonArray',
'tagList.noOrJsonArray'=>'调用标签必须为json数组',

'age'   => 'number|between:1,120',
'age.between'  => '年龄只能在1-120之间',
     * */
}